package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.WmchannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/wmchannel")
public class WmchannelController {

    @Autowired
    private WmchannelService wmchannelService;
    @PostMapping("/findAll")
    public ResponseResult findAll(){
        return wmchannelService.findAll();
    }

    @GetMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id")Integer id){
        return ResponseResult.okResult(wmchannelService.delete(id));
    }

    @PostMapping("list")
    public ResponseResult list(@RequestBody ChannelDto dto){

        return ResponseResult.okResult(wmchannelService.list(dto));
    }
    @PostMapping("save")
    public ResponseResult save1(@RequestBody WmChannel wmChannel){
        return ResponseResult.okResult(wmchannelService.save1(wmChannel));
    }
    @PostMapping("update")
    public ResponseResult update1(@RequestBody WmChannel wmChannel)
    {
        return ResponseResult.okResult(wmchannelService.update1(wmChannel));
    }
}
